        <?php 
        
            $search_base_url=$html->url("/search");
            if($category)$search_base_url=$html->url(array("controller"=>"posts","action"=>"search",$category));
            
         ?>
        <div class="sidebar">
            <?php if(!($category)): ?>
            <div class="side">
                <ul>
                    <li class="altLi2">Services</li>
                    <?php foreach($cats as $item): ?>
                    <li>
                        <a href="<?php echo $html->url(array("controller"=>"posts","action"=>"search",$item["Category"]['id']));  ?>"><?php echo $item["Category"]["name"] ?></a>
                    </li>
                    <?php endforeach ?>
                    
                </ul>
            </div>
            <br />
            <?php endif ?>
            <div class="side">
                <ul>
                    <li class="altLi2">Browse By Location</li>
                    <?php foreach($locals as $item): ?>
                    <li>
                        <a href="<?php echo $search_base_url."/location:".$item["District"]['id']  ?>"><?php echo $item["District"]["name"] ?></a>
                    </li>
                    <?php if($item["children"]): ?>
                    <ul>
                        <?php foreach($item["children"] as $child): ?>
                        <li>
                            <a href="<?php echo $search_base_url."/location:".$child["District"]['id']  ?>"><?php echo $child["District"]["name"] ?></a>
                        </li>
                        
                        <?php endforeach ?>
                    </ul>
                    <?php endif ?>
                    <?php endforeach ?>
                    
                </ul>
            </div>
            <div class="adv">
                <small>Advertisement</small>
                <a href="">
                    <img src="/__DEV/img/2_sample-add.jpg" alt="">
                </a>                        
            </div>
        </div>
        <div class="middle">
            <div class="itemsInfo">
                
                <?php 
                $item_name="items";
                if(!empty($item_cat)): ?>
                <h1><?php echo $item_cat["Category"]["name"] ?> List</h1>
                <?php 
                $item_name=$item_cat["Category"]["name"];
                endif ?>
                <?php if(!empty($item_location)) echo "Location: ".$item_location["District"]["name"].($item_location["District"]["parent_id"]?", ".$item_location["District"]["Parent"]["District"]["name"]:"")."<br /><br />" ?>
                
                <div class="type1">
                    <?php 
                
                    $paginator->options(array('url'=>$this->passedArgs));
                    
                        
                        
                        
                    ?>
                    
                    <div class="type2">
                        <?php
                            echo "<span>".$paginator->counter(array(
                            'format' => __('Displaying <b>%start% to %end%</b> (of <b>%count%</b> '.$item_name.")", true)
                        )).'</span>';
                         ?>
                        
                    </div>
                </div>
                <?php 
                if($paginator->hasPrev() || $paginator->hasNext()){
                    echo '<div class="showResult"><p>Result Pages&nbsp;&nbsp;&nbsp;&nbsp;';
                                
                    if($paginator->hasPrev()) echo $paginator->prev('Previous', array('class'=>'next page-numbers', 'escape' => false));
                    echo $paginator->numbers(
                        array(
                            'class' => 'page-numbers', 
                            'separator' => ' ', 
                            'before' => ' ',
                            'after' => ' ',
                        )
                    );
                    if($paginator->hasNext()) echo $paginator->next('Next', array('class'=>'next page-numbers', 'escape' => false));
                    echo '</p></div>';
                }
                
                ?>
                <?php foreach($posts as $item): 
                //print_r($item)
                ?>        
                <div class="suppliesInfo1">
                    <div class="suppliesInfo2">
                        <strong><a href="<?php e($html->url("/details/".$item['Post']['id'])) ?>"><?php echo $item['Post']['name'] ?></a></strong>
                        <p style="padding:0;">
                            <?php 
                            // doctors
                            if($item['Post']['category_id']==1):?>
                                <?php if(count($item['Degree'])): ?>
                                Degree: <?php foreach($item['Degree'] as $d) echo '<b>'.$d['name'].'</b>,&nbsp;' ?><br />
                                <?php endif ?>
                                Chamber Address: <?php e($item['Post']['address']) ?><br />
                            <?php else: ?>
                                Address: <?php e($item['Post']['address']) ?><br />
                            <?php endif ?>
                        </p>
                        <p>
                            District/Location: <i style="color: red; font-style: normal;"><?php e($item['District']['name']) ?></i><br />
                            Phone: <i  style="color: red; font-style: normal;"><?php e($item['Post']['phone']) ?></i><br />
                        </p>
                    </div>
                    <?php if(count($item['Media'])): ?>
                    <span class="suppliesInfo3" style="overflow: hidden;">
                        <i></i>
                        
                        <a href="">
                            <img width="170" title="<?php echo $item['Post']['name'] ?>" src="<?php echo $html->url("/img/uploads/").$item['Media']['file_media'] ?>">
                        </a>
                        
                    </span>
                    <?php endif ?>
                </div>
                <?php endforeach; ?>
                <?php 
                if($paginator->hasPrev() || $paginator->hasNext()){
                    echo '<div class="showResult"><p>Result Pages&nbsp;&nbsp;&nbsp;&nbsp;';
                                
                    if($paginator->hasPrev()) echo $paginator->prev('Previous', array('class'=>'next page-numbers', 'escape' => false));
                    echo $paginator->numbers(
                        array(
                            'class' => 'page-numbers', 
                            'separator' => ' ', 
                            'before' => ' ',
                            'after' => ' ',
                        )
                    );
                    if($paginator->hasNext()) echo $paginator->next('Next', array('class'=>'next page-numbers', 'escape' => false));
                    echo '</p></div>';
                }
                
                ?>
        </div>
        </div>
    